<template>
	<!-- 开奖结果 -->
	<view class="w-750 h-641 w-fixed-top w-bj-content w-column-align" v-if="show">
		<!-- 开奖时间 120-->
		<view class="w-720 h-120 w-row-justify-between-align ">
			<view class="w-250 font-32b w-wz-cont w-column">
				<image class="w-140 h-50" src="../../../static/gane/amlhc.png"></image>
				<text class="font-26b w-wz-gree">{{room_name}}</text>
			</view>
			
			<view class="w-220 h-70 w-relative ">
				<image class="w-220 h-70" src="../../../static/gane/the_countdown.png"></image>
				<view class="w-220 h-66 w-absolute-left w-wz-white w-row-center font-30b">
					{{issue}} 结果
				</view>
			</view>
			
<!-- 			<view class="w-260 w-column-end-justify-around font-26b w-wz-black8">
				<text> <text class="w-wz-gree font-26b">第{{Number(issue)+1}}</text></text>
				<text>下一结果时间 <text class="w-wz-gree font-26b">21:35:00</text></text>
			</view> -->
		</view>

		<!-- 开奖数字结果 300-->
		<view class="w-700 h-260">

			<view class="w-700 h-160 w-row-justify-center-align">

				<view v-for="(item,index) in number">
					<view class="w-90 h-130 w-column-align" v-if="index <=5">
						<view class="w-row-center numbers" :class="item.color">
							{{item.number}}
						</view>
						<text class="font-26 w-wz-cont">{{item.name}}</text>
					</view>

				</view>

				<view class=" w-wz-white font-60b w-wz-conts m-right-10">
					+
				</view>

				<view v-if="number.length" class="w-90 h-130">
					<view class="w-row-center numbers" :class="number[6].color">
						{{number[6].number}}
					</view>
					<text class="font-26 w-wz-cont">{{number[6].name}}</text>
				</view>
			</view>

			<view class="w-700 h-80 w-bj-cont w-wz-gree font-32 w-row-center w-bor-12" v-if="title">
				<text class="m-bottom-6">第 <text class="w-wz-red">{{Number(issue)+1}}</text> 期{{title}} </text>
			</view>
			<view class="w-700 h-80 w-bj-cont w-wz-gree font-32 w-row-center w-bor-12" v-else>
				<text class="m-bottom-6">第 <text class="w-wz-red">{{Number(issue)+1}}</text> 下单倒计时 </text>
				<uni-countdown :show-day="false" :font-size="18" :showColon="false" color="#ff0000"
					splitorColor="#ff0000" :hour="end_time.hour" :minute="end_time.minute" :second="end_time.second">
				</uni-countdown>
			</view>
		</view>
	


		<!-- 用户信息 220 -->
		<view class="w-750 h-220 w-column-align w-bj-cont w-relative">

			<view class="w-700 h-60 m-top-20 w-row-align">
				<view class="w-wz-blue w-bk-blues w-bor-12 p-zy16 font-26 w-row-center" @click="RouteIndex(6)">
					<text class="m-bottom-2">充值</text>
				</view>
				<text class="p-10"></text>
				<view class="w-wz-gree w-bk-grees w-bor-12 p-zy16 font-26 w-row-center" @click="RouteIndex(7)">
					<text class="m-bottom-2">提现</text>
				</view>
				<text class="p-10"></text>
				<text class="w-wz-red font-30">余额￥<text>{{amoney}}</text></text>
				<text class="p-10"></text>
				<view class="w-row-center w-wz-conts w-mauto" @click="gameRule()">
					<text class="font-30 m-right-6 m-bottom-4">规则</text>
					<image class="wh-30" src="../../../static/gane/yw.png"></image>
				</view>
			</view>

			<!-- 键盘处 -->
			<view class="w-700 h-120 w-row-justify-between-align ">
				<input v-model="input_value"
					style="width: 420rpx; background-color: #f8f8f8; border: solid 6rpx #ccb581; font-size: 32rpx;"
					class="h-50 w-bor-12 p-6" @focus="getFocus" placeholder="请输入内容" @confirm="confirmValue" />
				<view class="h-120 w-row-align" hover-class="pulse" @click="keyboardBet()">
					<image class="wh-90" src="../../../static/gane/jp.png"></image>
				</view>

				<view style="width: 150rpx; height: 72rpx; color: #272727; background-color: #ccb581; font-weight: 700;"
					class="w-bor-12 w-row-center" hover-class="pulse">
					<text class="m-bottom-2 font-32b" @click="quickBet()">快捷下单</text>
				</view>
			</view>


			<!-- 键盘 -->
			<view v-if="showKey" style="width: 750rpx; position: absolute; top: 220rpx; left: 0;">
				<view style="height: 70vh;" @click="closeShowKey()">
					<view style="border-radius: 0 0 25rpx 25rpx;" class="w-column-align w-bj-content" @click.stop="">
						<view class="h-10"></view>
						<view class="w-710 w-row-wrap-justify-between-align">
							<view v-for="val in keyval" class="skeyboard" @click="keyboardValue(val)">{{val}}</view>
							<view class="skeyboard" @click="keyboardValue('.')">&#x2022;</view>
							<view class="skeyboard" @click="keyboardValue(' ')">
								<image class="wh-55" src="../../../static/gane/kg.png"></image>
							</view>
							<view class="skeyboard" @click="deleteKeyboardValue()">
								<image class="wh-45" src="../../../static/gane/tg.png"></image>
							</view>
							<view class="skeyboard" style="color: #af0000; width: 131rpx;" @click="cancelForm">清空</view>
							<view class="skeyboard" style="color: #009445; width: 131rpx;" @click="defineForm">确定</view>
						</view>

						<view class="w-300 h-120 w-row-center w-wz-conts">
							<view class="w-row-center w-200 h-80" @click.stop="betRule()">
								<text class="font-28 m-right-6 m-bottom-4">下单规则</text>
								<image class="wh-30" src="../../../static/gane/yw.png"></image>
							</view>
						</view>
					</view>
				</view>

			</view>


			<!-- 快捷 -->
			<view v-if="quicKey" style="width: 750rpx; position: absolute; top: 220rpx; left: 0;"
				class="w-column-align w-bj-content">
				<view class="h-30"></view>
				<view class="w-720  w-relative">
					<image class="w-720 h-120" src="../../../static/gane/game-tit.png"></image>
					<view class="w-720 h-120 w-absolute-left w-wz-white w-row-center font-32b">
						<view class="w-630 h-100 w-row-justify-evenly">
							<view class="w-90 h-70 w-row-center" :class="tabIndex == 1 ? 'tabbtn':''"
								hover-class="pulse" @click="tabindex(1)">特码</view>
							<view class="w-90 h-70 w-row-center" :class="tabIndex == 2 ? 'tabbtn':''"
								hover-class="pulse" @click="tabindex(2)">特肖</view>
							<view class="w-150 h-70 w-row-center" :class="tabIndex == 3 ? 'tabbtn':''"
								hover-class="pulse" @click="tabindex(3)">平特一肖</view>
							<view class="w-110 h-70 w-row-center" :class="tabIndex == 4 ? 'tabbtn':''"
								hover-class="pulse" @click="tabindex(4)">三中三</view>
							<view class="w-90 h-70 w-row-center" :class="tabIndex == 5 ? 'tabbtn':''"
								hover-class="pulse" @click="tabindex(5)">3连肖</view>
						</view>
					</view>
				</view>

				<!-- 特码 -->
				<view v-if="tabIndex == 1" style="width: 700rpx; height: 50vh; overflow: scroll;">
					<view class="w-row-wrap-justify-center">
						<view class="wh-100 betbtn" v-for="(item,index) in gameData.room_odds.tema.list"
							@click="chooseTema(item,index)" :class="{betbtns:item.checked==1}">
							<text class="font-36b">{{item.number}}</text>
							<text class="font-22" v-if="item.odds">x{{item.odds}}</text>
							<text class="font-22" v-else>x0</text>
						</view>
					</view>
					<view class="h-100 w-row-center">
						<image class="wh-50" src="../../../static/gane/jpgb.png" @click="closeQuicKey()"></image>
					</view>
					<view class="h-300"></view>
				</view>


				<!-- 特肖 -->
				<view v-if="tabIndex == 2" style="width: 700rpx; height: 50vh; overflow: scroll;">
					<view class="w-row-wrap-justify-center">
						<view class="w-180 h-100 betbtn" v-for="(item,index) in gameData.room_odds.texiao.list"
							@click="chooseTexiao(item,index)" :class="{betbtns:item.checked==1}">
							<text class="font-36b">{{item.number}}</text>
							<text class="font-22" v-if="item.odds">x{{item.odds}}</text>
							<text class="font-22" v-else>x0</text>
						</view>
					</view>

					<view class="h-100 w-row-center">
						<image class="wh-50" src="../../../static/gane/jpgb.png" @click="closeQuicKey()"></image>
					</view>
					<view class="h-300"></view>
				</view>

				<!-- 平特一肖 -->
				<view v-if="tabIndex == 3" style="width: 700rpx; height: 50vh; overflow: scroll;">
					<view class="w-row-wrap-justify-center">
						<view class="w-180 h-100 betbtn" v-for="(item,index) in gameData.room_odds.pingteyixiao.list"
							@click="choosePingteyixiao(item,index)" :class="{betbtns:item.checked==1}">
							<text class="font-36b">{{item.number}}</text>
							<text class="font-22" v-if="item.odds">x{{item.odds}}</text>
							<text class="font-22" v-else>x0</text>
						</view>
					</view>

					<view class="h-100 w-row-center">
						<image class="wh-50" src="../../../static/gane/jpgb.png" @click="closeQuicKey()"></image>
					</view>
					<view class="h-300"></view>

				</view>

				<!-- 三中三 -->
				<view v-if="tabIndex == 4" style="width: 700rpx; height: 50vh; overflow: scroll;">
					<view class="w-row-wrap-justify-center">
						<view class="wh-100 betbtn" v-for="(item,index) in gameData.room_odds.sanzhongsan.list"
							@click="chooseSanzhongsan(item,index)" :class="{betbtns:item.checked==1}">
							<text class="font-36b">{{item.number}}</text>
							<text class="font-22" v-if="item.odds">x{{item.odds}}</text>
							<text class="font-22" v-else>x0</text>
						</view>
					</view>

					<view class="h-100 w-row-center">
						<image class="wh-50" src="../../../static/gane/jpgb.png" @click="closeQuicKey()"></image>
					</view>
					<view class="h-300"></view>
				</view>


				<!-- 连肖 -->
				<view v-if="tabIndex == 5" style="width: 700rpx; height: 50vh; overflow: scroll;">
					<view class="w-row-wrap-justify-center">
						<view class="w-180 h-100 betbtn" v-for="(item,index) in gameData.room_odds.lianxiao.list"
							@click="chooseLianxiao(item,index)" :class="{betbtns:item.checked==1}">
							<text class="font-36b">{{item.number}}</text>
							<text class="font-22" v-if="item.odds">x{{item.odds}}</text>
							<text class="font-22" v-else>x0</text>
						</view>
					</view>

					<view class="h-100 w-row-center">
						<image class="wh-50" src="../../../static/gane/jpgb.png" @click="closeQuicKey()"></image>
					</view>
					<view class="h-300"></view>
				</view>

			</view>
		</view>

	</view>

	<view class="w-750 h-620"></view>

	<view v-if="show"
		style="display: flex; flex-direction: column; align-items: center; width: 120rpx; height: 500rpx; position: fixed; top: 650 rpx; left: 0;">
		<view class="tools m-bottom-20" @click="RouteIndex(1)">主页</view>
		<view class="tools m-bottom-20" @click="RouteIndex(2)">刷新</view>
		<view v-if="agent_code" class="tools m-bottom-20" @click="RouteIndex(3)">邀请</view>
		<view class="tools m-bottom-20" @click="RouteIndex(4)">订单</view>
		<view class="tools m-bottom-20" @click="RouteIndex(5)">走势</view>
	</view>

	<view class="w-750 w-column-end" id="scroll-view-content">

		<view class="w-550 w-wz-black3 m-top-10" v-if="end_time.minute >=0">
			<view style="justify-content: flex-end" class="w-530 h-60  w-row-align font-26 w-wz-conts">
				<text class="m-right-10">{{stopTime}} <text class="w-wz-gree"> [开始通知] </text></text>
				<view class="h-80 w-row-align ">
					<image class="wh-70 m-left-20 w-bor-50 w-bk-conts" src="../../../static/gane/kefu.png">
					</image>
				</view>
			</view>
			<view class="w-410 p-20 w-column w-wz-conts w-bor-12" style="background-color: #272727;">
				<text class="font-26">
					尊敬的会员 <text class="w-wz-name">{{UserInfo.nickname}}</text> 您好，第 <text
						class="w-wz-gree">{{Number(issue)+1}}</text> 活动正在进行中,抓紧上车哦！
				</text>
			</view>
		</view>

		<view class="w-550 w-wz-black3 m-top-10" v-for="item in pour_array">
			<view style="justify-content: flex-end" class="w-530 h-50  w-row-align font-26 w-wz-conts">
				<text class="m-right-10">{{item.create_time}} <text style="color: #ffaa00;"> [订单通知] </text></text>
				<view class="h-80 w-row-align">
					<image class="wh-70 m-left-20 w-bor-50 w-bk-conts" :src="item.headimgurl" v-if="item.headimgurl">
					</image>
					<image class="wh-70 m-left-20 w-bor-50 w-bk-conts" src="../../../static/gane/kefu.png" v-else>
					</image>
				</view>
			</view>
			<view class="w-410 p-20 w-column w-wz-conts font-22 w-bor-12" style="background-color: #272727;">
				<text>期号: {{item.issue}}</text>
				<text>用户: {{item.nickname}}</text>
				<text>号码: {{item.number}}</text>
				<text>金额: ￥{{item.money}}</text>
				<text>时间: {{item.create_time}}</text>
			</view>
		</view>

		<view class="w-550 w-wz-black3 m-top-10" v-if="title">
			<view style="justify-content: flex-end" class="w-530 h-60  w-row-align font-26 w-wz-conts">
				<text class="m-right-10">{{stopTime}}</text>
				<view class="h-80 w-row-align"> <text class="w-wz-red"> [结束通知] </text>
					<image class="wh-70 m-left-20 w-bor-50 w-bk-conts" src="../../../static/gane/kefu.png"> </image>
				</view>
			</view>
			<view class="w-430 p-20 w-column w-wz-conts w-bor-12" style="background-color: #272727;">
				<text class="font-26">
					尊敬的用户您好，第 <text class="w-wz-name">{{Number(issue)+1}}</text> <text>已结束，结束期间停止下单
						谢谢您的参与。</text>
				</text>
			</view>
		</view>
		<view class="wh-100"></view>
	</view>

	<view v-if="pourData.length >=1" class="w-fixed-bottom w-750 h-100 w-bj-content w-bor-top w-row-center">
		<view class="w-row-align">
			<button size="mini" type="warn" @click="initArray()">清空</button>
			<view class="p-zy20 w-wz-conts font-30">共 {{pourData.length}} 单</view>
			<button size="mini" type="primary" :disabled="showbtn" @click="openPopup">确定</button>
		</view>
	</view>

	<uni-popup ref="popup" type="bottom">
		<view style="border-radius:25rpx 25rpx 0 0;" class="w-bj-cont w-column-align w-wz-conts">
			<view class="h-30"></view>
			<view class="w-720 h-80 w-wz-white w-row-justify-between-align w-bor-bottom font-30">
				<view class="w-130 w-row-center">类型</view>
				<view class="w-130 w-row-center">号码</view>
				<view class="w-130 w-row-center">倍数</view>
				<view class="w-150 w-row-center">金额</view>
				<view class="w-180 w-row-center">中奖(含本金)</view>
			</view>
			<view class="w-720 h-80 w-wz-conts w-row-justify-between-align w-bor-bottom font-28"
				v-for="item in pourData">
				<view class="w-130 w-row-center">{{name}}</view>
				<view class="w-130 w-row-center">{{item.number}}</view>
				<view class="w-130 w-row-center">x{{item.odds}}</view>
				<view class="w-150 w-row-center">￥{{money ? money : 0}}</view>
				<view class="w-180 w-row-center">￥{{ (item.odds*money) | currency}}</view>
			</view>


			<view class="w-680 h-80 w-wz-white w-row-justify-between-align font-28">
				<view class="w-100"></view>
				<text class="w-row-center w-wz-conts">第<text style="color: #45cf00;">{{issue+1}}</text> 共<text
						style="color: #45cf00;">{{pourData.length}}</text>单 合计金额¥<text
						style="color: #45cf00; margin-left: 5rpx;">{{pourData.length*money}}</text> </text>
			</view>

			<view class="w-700 w-row-justify-around-align">
				<view class="w-500 h-100">
					<view class="wh-100 pour-info" hover-class="pulse" style="background-position: center -222rpx;"
						@click="pourMoney(50)">
					</view>
					<view class="wh-100 pour-info" hover-class="pulse" style="background-position: center -333rpx;"
						@click="pourMoney(100)">
					</view>
					<view class="wh-100 pour-info" hover-class="pulse" style="background-position: center -444rpx;"
						@click="pourMoney(500)">
					</view>
					<view class="wh-100 pour-info" hover-class="pulse" style="background-position: center -555rpx;"
						@click="pourMoney(1000)"></view>
					<view class="wh-100 pour-info" hover-class="pulse" style="background-position: center -666rpx;"
						@click="pourMoney(5000)"></view>
				</view>
				<view class="w-160">
					<input v-model="money" type="number" class="p-10 w-bk-conts w-bor-12 font-28" placeholder="自定金额"
						placeholder-class="w-wz-conts" />
				</view>
			</view>

			<view class="w-row-align h-150">
				<button size="mini" type="warn" @click="initArray()">清空订单</button>
				<text class="p-20"></text>
				<button size="mini" type="primary" :disabled="showbtn" @click="submitOrder()">确定下单</button>
			</view>
		</view>

	</uni-popup>


	<!-- 键盘规则 -->
	<uni-popup ref="popupbet" type="center">
		<view class="w-450 w-bj-white w-bor-12 w-column-align p-30">
			<text class="w-wz-black3 font-32b">键盘下单规则</text>
			<view class="w-column w-360 font-28 m-top-10">
				<text><text>特码10号下单100</text><text> 规则：10.100</text></text>
				<text><text>特码16号下单200</text><text> 规则：16.200</text></text>
				<text><text>特肖牛下单100</text><text> 规则：牛.100</text></text>
				<text><text>特肖虎下单100</text><text> 规则：虎.100</text></text>
				<text class="w-wz-red">以此类推，下单以<text class="font-28b"> . </text>分割 点前面代表号码 点后面代表金额, 键盘下单 只支持 <text
						class="w-wz-gree">特码</text>和<text class="w-wz-gree">特肖 </text>，其他下单方式请到 快捷下单</text>
			</view>

			<view class="wh-50"></view>

		</view>
	</uni-popup>

	<!-- 规则 -->
	<uni-popup ref="popupgame" type="center">
		<view class="w-450 w-bj-white w-bor-12 w-column-align p-30">
			<text class="w-wz-black3 font-32b">规则如下</text>
			<rich-text :nodes="Config.app_aomen_rich_text"></rich-text>
			<view class="wh-20"></view>
		</view>
	</uni-popup>

</template>

<script>
	import $H from '@/pages/common/request.js'
	export default {

		data() {
			return {
				keyval: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊',
					'猴', '鸡', '狗', '猪'
				], //键盘值
				issue: '0000000', //已开奖期号
				number: [], //已开奖号码
				tabIndex: 1, // tab索引
				showKey: false, //键盘
				quicKey: false, //快捷
				showbtn: false,
				input_value: '', //键盘下注
				input_list: [], //数据拼接,
				room_label: '', //房间标识
				gameData: null, //赔率数据
				pourData: [], //下注数据
				pourDataArr: [],
				money: null, //下注金额
				money_min: null, //最小下注金额
				money_max: null, //最大下注金额
				name: '', // 下注名称
				bet_name: null,
				timer: 1,
				amoney: 0,
				end_time: {},
				title: null,
				show: false,
				agent_code: null,
				pour_array: [],
				show: false,
				room_name: null,
				Config: {},
				last_time: ''

			}
		},

		onLoad(option) {

			this.Config = uni.getStorageSync('Config');
			this.UserInfo = uni.getStorageSync('UserInfo');
			const room_label = option.room_label;
			// if (typeof room_label === 'undefined') {
			// 	return uni.reLaunch({
			// 		url: '/pages/index/index'
			// 	});
			// } else {
				this.room_label = room_label
				this.getRoomOdds(this.room_label)
				this.getIssueData()
				this.AutoLoadTime()
			// }
		},

		onUnload() {
			clearInterval(this.timer)
			console.log('页面卸载')
		},

		onHide() {
			clearInterval(this.timer)
			console.log('页面隐藏')
		},
		filters: {
			currency(value) {
				return value.toFixed(2)
			}
		},

		methods: {
			// 自动加载
			AutoLoadTime() {
				clearInterval(this.timer)
				this.timer = setInterval(() => {
					this.getIssueData()
				}, 5000);
			},

			// 获取开奖信息
			getIssueData() {

				$H.post('/app_aomen_issue_data', {
					last_time: this.last_time,
					room_label: this.room_label
				}).then((res) => {
					console.log(res)
					if (res.code == 200) {
						this.show = true
						this.title = res.data.title
						this.issue = res.data.issue
						this.number = res.data.number
						this.end_time = res.data.end_time
						this.agent_code = res.data.agent_code
						this.amoney = res.data.amoney
						this.last_time = res.data.last_time

						let pourArray = res.data.pour_array
						pourArray.forEach((value) => {
							if (this.pour_array.length == 0) {
								this.pour_array.push(value)
							}
							let result = this.pour_array.find(item => item.id == value.id)
							if (!result) {
								this.pour_array.push(value)
							}

						})

						this.scrollToBottom()
						this.stopTime = this.timestampToTime()
					} else {
						uni.reLaunch({
							url: '/pages/index/index'
						});
						return uni.showToast({
							title: res.msg,
							duration: 1000,
							icon: 'none'
						});
					}
				})
			},
			// 获取房间赔率
			getRoomOdds(room_label) {

				$H.post('/app_aomen_room_odds', {
					room_label
				}).then((res) => {
					console.log(res)
					if (res.code == 200) {
						if (res.data.room_odds) {
							this.gameData = res.data
							this.room_name = res.data.room_name
						}
					} else {
						return uni.showToast({
							title: res.msg,
							duration: 1000,
							icon: 'none'
						});
					}
				})
			},

			// 提交订单
			submitOrder(obj) {
                this.showbtn = true 
				const formData = {
					bet_type: null,
					bet_array: [],
					bet_money: null,
					bet_name: this.bet_name,
					bet_label: this.room_label
				}

				if (typeof obj == 'undefined') {

					if (Number(this.money) < Number(this.money_min)) {
						return uni.showToast({
							title: `下单金额不能小于${this.money_min}`,
							duration: 1000,
							icon: 'none'
						});
					}

					if (Number(this.money) > Number(this.money_max)) {
						return uni.showToast({
							title: `下单金额不能大于${this.money_max}`,
							duration: 1000,
							icon: 'none'
						});
					}

					formData.bet_type = 1
					formData.bet_array = this.pourData
					formData.bet_money = this.money
				} else {

					if (obj.money <= 0) {
						return uni.showToast({
							title: `下单金额不能为空`,
							duration: 1000,
							icon: 'none'
						});
					}

					formData.bet_type = 2
					formData.bet_array.push(obj)
					formData.bet_money = obj.money
				}

				// 提交订单
				$H.post('/app_aomen_betpour', formData).then((res) => {
					
					uni.showLoading({
						title: '下单中'
					});

					if (res.code == 200) {

						setTimeout(() => {
							uni.hideLoading();
							this.showbtn = false
							this.showKey = false
							this.initArray()
							uni.showToast({
								title: res.msg,
								duration: 1000,
								icon: 'none'
							});

						}, 1000);

					} else {
						this.showbtn = false
						return uni.showToast({
							title: res.msg,
							duration: 1000,
							icon: 'none'
						});
					}
				})

			},

			// ----------------------------------------快捷下单-----------------------------------
			// 特码
			chooseTema(item, index) {
				console.log(this.gameData.room_odds.tema,'this.gameData.room_odds.tema')
				this.selectBetdata(item, index, this.gameData.room_odds.tema)
			},
			// 特肖
			chooseTexiao(item, index) {
				this.selectBetdata(item, index, this.gameData.room_odds.texiao)
			},
			// 平特一肖
			choosePingteyixiao(item, index) {
				this.selectBetdata(item, index, this.gameData.room_odds.pingteyixiao)
			},
			// 三中三
			chooseSanzhongsan(item, index) {
				this.selectBetdatass(item, index, this.gameData.room_odds.sanzhongsan)
			},

			// 连肖
			chooseLianxiao(item, index) {
				this.selectBetdatass(item, index, this.gameData.room_odds.lianxiao)
			},

			// 三中三连肖
			selectBetdatass(data, index, typedata) {

				if (Number(this.end_time.second) < 0) {
					return uni.showToast({
						title: `${this.issue+1}结束下单中`,
						duration: 1000,
						icon: 'none'
					});
				}

				if (!data.odds) {
					return uni.showToast({
						title: '请先设置倍数',
						duration: 1000,
						icon: 'none'
					});
				}
				
				console.log(typedata,'typedata')

				this.name = typedata.name
				this.money = typedata.money_min
				this.bet_name = typedata.type_name
				this.money_min = typedata.money_min
				this.money_max = typedata.money_max

				if (this.pourDataArr.includes(data)) {

					this.pourDataArr.forEach((value, key) => {
						if (value.number == data.number) {
							this.pourDataArr.splice(key, 1);
							typedata.list[index].checked = 0
							this.pourData = []
						}
					})

				} else {

					if (this.pourDataArr.length >= 3) {
						return uni.showToast({
							title: '3个号码为一单',
							duration: 1000,
							icon: 'none'
						});
					}

					this.pourDataArr.push(data);
					if (this.pourDataArr.length >= 3) {

						let arr = []
						let odds = null
						this.pourDataArr.forEach((value) => {
							console.log(value.number)
							arr.push(value.number)
							odds = value.odds
						})

						let str = arr.join(',')
						let obj = {
							number: str,
							odds: odds
						}

						this.pourData.push(obj)

					}

					typedata.list[index].checked = 1

				}
			},

			selectBetdata(data, index, typedata) {

				if (Number(this.end_time.second) < 0) {
					return uni.showToast({
						title: `${this.issue+1}结束中`,
						duration: 1000,
						icon: 'none'
					});
				}

				if (!data.odds) {
					return uni.showToast({
						title: '请先设置倍数',
						duration: 1000,
						icon: 'none'
					});
				}

				this.name = typedata.name
				this.money = typedata.money_min
				this.bet_name = typedata.type_name
				this.money_min = typedata.money_min
				this.money_max = typedata.money_max


				if (this.pourData.includes(data)) {

					this.pourData.forEach((value, key) => {
						if (value.number == data.number) {
							this.pourData.splice(key, 1);
							typedata.list[index].checked = 0
						}
					})

				} else {

					if (this.pourData.length >= 5) {
						return uni.showToast({
							title: '单次下单不能超过5个',
							duration: 1000,
							icon: 'none'
						});
					}

					this.pourData.push(data);
					typedata.list[index].checked = 1

				}
			},

			// 初始化数据
			initArray() {
				this.pourData.forEach((v, k, a) => {
					a[k].checked = 0
				})
				this.pourDataArr.forEach((v, k, a) => {
					a[k].checked = 0
				})
				this.pourData = []
				this.pourDataArr = []
				this.bet_name = null
				this.input_value = ''
				this.input_list = []
				this.$refs.popup.close()
			},
			quickBet() {

				if (!this.gameData) {
					return uni.showToast({
						title: '请先设置倍数',
						duration: 1000,
						icon: 'none'
					});
				}
				this.quicKey = !this.quicKey
				this.showKey = false
				this.initArray()
			},
			tabindex(tabIndex) {
				this.tabIndex = tabIndex
				this.initArray()
			},
			// 下注金额
			pourMoney(money) {
				this.money = money
			},

			// 关闭快捷
			closeQuicKey() {
				this.quicKey = false
				this.showKey = false
				this.initArray()
			},
			// 关闭键盘 
			closeShowKey() {
				this.showKey = false
				this.initArray()
			},


			deleteKeyboardValue() {
				this.input_list.pop()
				this.input_value = this.input_list.join("")
			},


			// ----------------------------------------键盘下注-----------------------------------
			keyboardBet() {
				if (!this.gameData) {
					return uni.showToast({
						title: '请先设置倍数',
						duration: 1000,
						icon: 'none'
					});
				}
				this.showKey = !this.showKey
				this.quicKey = false
				this.initArray()
			},

			// 监听输入框
			getFocus() {
				this.quicKey = false
				this.showKey = false
				this.initArray()
			},
			// 初始数据
			cancelForm() {
				this.input_list = []
				this.input_value = ''
			},

			// 键盘确定
			confirmValue() {
				this.defineForm()
			},

			// 确定发送数据
			defineForm() {
				if (Number(this.end_time.second) < 0) {
					return uni.showToast({
						title: `${this.issue+1}结束中`,
						duration: 1000,
						icon: 'none'
					});
				}

				if (this.input_value == '') {
					return uni.showToast({
						title: '下单内容为空',
						duration: 1000,
						icon: 'none'
					});
				}

				let inputArray = this.input_value.split(" ")

				const arrval = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16',
					'17',
					'18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33',
					'34',
					'35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '鼠', '牛',
					'虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪'
				]
				inputArray.forEach((value) => {
					if (value) {
						
						let arr0 = null;
						let arr1 = null;
						
						let arr = value.split(".")

						if (arr.length == 2) {
							arr0 = arr[0];
							arr1 = arr[1];
						}else{
							let arr = value.match(/(\D*)(\d*)/);
							if(arr.length == 3){
								arr0 = arr[1];
								arr1 = arr[2];
							}else{
								return uni.showToast({
									title: '下单规则错误',
									duration: 1000,
									icon: 'none'
								});
							}	
						}

						if (isNaN(Number(arr1))) {
							return uni.showToast({
								title: '下单金额错误',
								duration: 1000,
								icon: 'none'
							});
						}

						if (arr0.trim() == "" || arr0.trim() == null) {
							return uni.showToast({
								title: '下单号码为空',
								duration: 1000,
								icon: 'none'
							});
						}



						let obj = {
							number: arr0,
							money: arr1
						}

						if (arrval.includes(arr0)) {
							this.money = arr1
							this.submitOrder(obj)
						} else {
							return uni.showToast({
								title: '下单号码错误',
								duration: 1000,
								icon: 'none'
							});
						}
					}
				})


			},

			// 输入框数据拼接
			keyboardValue(value) {
				this.input_list.push(value)
				this.input_value = this.input_list.join("")
			},

			// 弹出层
			openPopup() {
				this.$refs.popup.open('bottom')
			},


			gameRule() {
				this.$refs.popupgame.open('center')
			},

			betRule() {
				this.$refs.popupbet.open('center')
			},


			RouteIndex(index) {

				if (index == 1) {
					uni.switchTab({
						url: '/pages/index/index'
					});
				}
				if (index == 2) {
					location.reload()
				}
				if (index == 3) {
					uni.navigateTo({
						url: '/pages/my/agent/agent'
					});
				}
				if (index == 4) {
					uni.navigateTo({
						url: '/pages/my/order/order'
					});
				}
				if (index == 5) {
					uni.navigateTo({
						url: '/pages/game/aomen/redord'
					});
				}

				if (index == 6) {
					uni.navigateTo({
						url: '/pages/my/wallet/save_amoney'
					});
				}

				if (index == 7) {
					uni.navigateTo({
						url: '/pages/my/wallet/take_amoney'
					});
				}
			},


			scrollToBottom() {
				this.$nextTick(() => {
					uni.createSelectorQuery().select("#scroll-view-content").boundingClientRect(res => {
						uni.pageScrollTo({
							scrollTop: res.height,
							duration: 300
						});
					}).exec()
				})
			},

			timestampToTime() {
				let timestamp = Date.now()
				var date = new Date(timestamp);
				var Y = date.getFullYear() + '-';
				var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
				var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
				var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
				var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
				var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
				return Y + M + D + h + m + s;
			}
		}
	}
</script>

<style scoped>
	.numbers {
		width: 60rpx;
		height: 60rpx;
		border: 3rpx #ccb581 solid;
		color: #ffffff;
		font-size: 36rpx;
		font-weight: 600;
		border-radius: 60rpx;
		text-align: center;
	}

	.green {
		background-image: radial-gradient(closest-side at 60% 15%, #ffffff, #00cf0a);
	}

	.red {
		background-image: radial-gradient(closest-side at 60% 15%, #ffffff, #dd0000);
	}

	.blue {
		background-image: radial-gradient(closest-side at 60% 15%, #ffffff, #0055ff);
	}


	.pour-info {
		width: 100rpx;
		height: 100rpx;
		display: inline-block;
		background: url("../../../static/gane/chouma.png") no-repeat center top/ 100rpx auto;
	}

	.skeyboard {
		width: 80rpx;
		height: 70rpx;
		margin: 6rpx;
		margin-top: 20rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		background-color: #ccb581;
		font-size: 32rpx;
		font-weight: 700;
		border-radius: 12rpx;
		color: #4a4a4a;
		box-shadow: 0 10rpx #8a7856;
	}

	.skeyboard:hover {
		background-color: #ccb581
	}

	.skeyboard:active {
		background-color: #b09c6f;
		box-shadow: 0 3px #666;
		transform: translateY(2px);
	}


	.tools {
		width: 80rpx;
		height: 80rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		background-color: #ccb581;
		font-size: 26rpx;
		font-weight: 700;
		border-radius: 100rpx;
		color: #4a4a4a;
		box-shadow: 0 10rpx #8a7856;
	}

	.tools:hover {
		background-color: #ccb581
	}

	.tools:active {
		background-color: #b09c6f;
		box-shadow: 0 3px #666;
		transform: translateY(2px);
	}


	.tabbtn {
		color: #444444;
		background-color: #ccb581;
		border-radius: 12rpx;
		border: solid 3rpx #ffffff;
	}

	/* 下注 */
	.betbtn {
		margin: 8rpx;
		border: solid 3rpx #ebebeb;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		background-color: #ccb581;
		border-radius: 12rpx;
		color: #444444;
	}

	.betbtns {
		color: #ffffff;
		background-color: #d32a3d;
	}
</style>